package com.aaa.controller;

import com.aaa.service.StaffService;
import com.aaa.vo.Result;
import com.aaa.vo.StaffVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * @program: keyboard
 * @description:
 * @author: 闫克起2
 * @create: 2024-03-15 15:03
 **/
@RestController
@RequestMapping("/staff")
public class StaffController {


    @Autowired
    private HttpSession session;
    @Autowired
    private StaffService staffService;

    @GetMapping("/getInfo")
    public Result getInfo(){
        //获取当前登录者的用户信息。---session
        Object staff = session.getAttribute("staff");
        return new Result(200,"获取用户信息成功",staff);
    }
    @PostMapping("/list/{current}/{pageSize}")
    public Result list(@PathVariable Integer current,@PathVariable Integer pageSize,@RequestBody StaffVo staffVo){
        return staffService.findByPage(current,pageSize,staffVo);
    }
}
